#define _CRT_SECURE_NO_WARNINGS
#include<iostream>

using namespace std;
template <class T>
void  Swap(T& a, T& b)
{
	T temp = a;
	a = b;
	b = temp;
}
class A
{
	public:
		A(int a = 0)
			: _a(a)
		{
			cout << "A():" << this << endl;
		}
		/*~A()
		{

			cout << "~A():" << this << endl;
		}*/
private:
	int _a;
};
struct listnode
{
	int _val;
	listnode* _next;
	listnode(int val)
		:_val(val)
		,_next(nullptr)
	{


	}
};
int main()
{
	int* ptr1 = new int;
	int* ptr2 = new int[10];
	int* ptr3 = new int(3);
	int* ptr4 = new int[10]{1, 2, 3, 4, 5, };
	A* ptr7 = (A*)malloc(sizeof(A));
	A* ptr5 = new A;
	A* ptr6 = new A(3);
	A* ptr8 = new A[5];
	cout<<sizeof((*ptr8))<<endl;
	delete[] ptr8;
	delete ptr1;
	delete []ptr2;
	delete ptr3;
	delete[]ptr4;
	delete ptr5;

	delete ptr6;
	free(ptr7);
	listnode* p1 = new listnode(1);
	listnode* p2 = new listnode(2);
	listnode* p3 = new listnode(3);
	listnode* p4 = new listnode(4);
	p1->_next = p2;
	p2->_next = p3;
	p3->_next = p4;
	listnode* cur = p1;
	while (cur)
	{
		cout << cur->_val << "->";
		cur = cur->_next;
	}
	cout << "nullptr" << endl;
	delete p1;
	delete p2;
	delete p3;
	delete p4;
	int a = 1;int  b = 2;
	Swap(a, b);
	return 0;



}